<?php
namespace application\admin\panels;
use application\utilities\Utility;

class concerto_hosting extends panel {
	public $name = 'Concerto Hosting';
	
	public function handleData() {
		
	}
	
	public function display() {
		global $concerto;
		
		$this->displayMessages();
		?>
		<div class="box">
			
			<h3>Manage Accounts</h3>
			<form method="get">
				<input type="hidden" name="display" value="<?=getQueryVar('display')?>"/>
				<ul id="filter-content">
				<li><label for="status">Status</label>
					<select name="status">
						<option <?=(getQueryVar('status') == 'approved') ? 'selected="selected"' : ''?> value="approved">Approved (<?=DB()->getCount("SELECT `user_id` FROM `cn_users` WHERE `user_account_status`='approved'");?>)</option>
						<option <?=(getQueryVar('status') == 'pending') ? 'selected="selected"' : ''?> value="pending">Pending (<?=DB()->getCount("SELECT `user_id` FROM `cn_users` WHERE `user_account_status`='pending'");?>)</option>
						<option <?=(getQueryVar('status') == 'suspended') ? 'selected="selected"' : ''?> value="suspended">Suspended (<?=DB()->getCount("SELECT `user_id` FROM `cn_users` WHERE `user_account_status`='suspended'");?>)</option>
					</select>
				</li>
				<li><label>Order by</label>
				<select name="order">
					<option <?=(getQueryVar('order') == 'user_first_name') ? ' selected="selected"' : '';?> value="user_first_name">First Name</option>
					<option <?=(getQueryVar('order') == 'user_last_name') ? ' selected="selected"' : '';?> value="user_last_name">Last Name</option>
				</select>
				</li>
				<li>
					<label for="search">Search</label>
					<input type="text" name="search" value="<?=getQueryVar('search')?>"/>
				</li>
				<li>
					<input type="submit" value="Filter" name="filter_content" class="small-button"/>
				</li>
				</ul>
			</form>
			<form method="post">
			<table class="admin-table" width="100%">
				<thead>
					<tr>
						<th class="first" width="2%"><input type="checkbox" class="select-all"/></th>
						
						<?php foreach($shownColumns as $column) : ?>
						<th><?=$column?></th>
						<?php endforeach;?>
						<th width="15%">Actions</th>
						<th class="last" width="2%"></th>
					</tr>
				</thead>
				<tfoot>
					<tr>
						<th class="first" width="2%"><input type="checkbox" class="select-all"/></th>
						<?php foreach($shownColumns as $column) : ?>
						<th><?=$column?></th>
						<?php endforeach;?>
						<th width="15%">Actions</th>
						<th class="last" width="2%"></th>
					</tr>
				</tfoot>
				<tbody>
					
					<?php $style = ''; 
					while(hasResults()) : initResult();?>
					<tr<?=$style?>>
						<td><input type="checkbox" name="contents[]" value="<?php displayField('ID');?>" class="selectee-all"/></td>				
						<?php foreach($shownColumns as $value) : ?>
						<td><?php displayField($value);?></td>
						<?php endforeach;?>
						<td><a target="view" href="<?php displayField('Permalink');?>">View</a> | <a target="edit" href="<?=CN_URL?>?form=edit_content&id=<?php displayField('ID');?>">Edit</a></td>
						<td></td>
					</tr>
					<?php $style = ($style == ' class="alternate"') ? '' : ' class="alternate"';?>
					<?php endwhile;?>
				</tbody>
			</table>
		</div>
		<div class="bulk-actions">
			
			<select name="bulk_actions">
				<option value="">Bulk Actions</option>
				<option value="delete">Delete Selected</option>
				<option value="approve">Approve</option>
				<option value="hide">Hide</option>
				<option value="pending">Make Pending</option>
			</select>
			<input type="submit" class="small-button" value="Go" name="perform_bulk_actions"/>
			</form>
		</div>
		<?php
	}
}
?>